package com.cas.business.service.impl;

import java.util.List;
import com.cas.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cas.business.mapper.BizDeviceMapper;
import com.cas.business.domain.BizDevice;
import com.cas.business.service.IBizDeviceService;

/**
 * 设备Service业务层处理
 *
 * @author cas
 * @date 2024-02-28
 */
@Service
public class BizDeviceServiceImpl implements IBizDeviceService
{
    @Autowired
    private BizDeviceMapper bizDeviceMapper;

    /**
     * 查询设备
     *
     * @param deviceId 设备主键
     * @return 设备
     */
    @Override
    public BizDevice selectBizDeviceByDeviceId(Long deviceId)
    {
        return bizDeviceMapper.selectBizDeviceByDeviceId(deviceId);
    }

    /**
     * 查询设备列表
     *
     * @param bizDevice 设备
     * @return 设备
     */
    @Override
    public List<BizDevice> selectBizDeviceList(BizDevice bizDevice)
    {
        return bizDeviceMapper.selectBizDeviceList(bizDevice);
    }

    /**
     * 新增设备
     *
     * @param bizDevice 设备
     * @return 结果
     */
    @Override
    public int insertBizDevice(BizDevice bizDevice)
    {
        bizDevice.setCreateTime(DateUtils.getNowDate());
        return bizDeviceMapper.insertBizDevice(bizDevice);
    }

    /**
     * 修改设备
     *
     * @param bizDevice 设备
     * @return 结果
     */
    @Override
    public int updateBizDevice(BizDevice bizDevice)
    {
        bizDevice.setUpdateTime(DateUtils.getNowDate());
        return bizDeviceMapper.updateBizDevice(bizDevice);
    }

    /**
     * 批量删除设备
     *
     * @param deviceIds 需要删除的设备主键
     * @return 结果
     */
    @Override
    public int deleteBizDeviceByDeviceIds(Long[] deviceIds)
    {
        return bizDeviceMapper.deleteBizDeviceByDeviceIds(deviceIds);
    }

    /**
     * 删除设备信息
     *
     * @param deviceId 设备主键
     * @return 结果
     */
    @Override
    public int deleteBizDeviceByDeviceId(Long deviceId)
    {
        return bizDeviceMapper.deleteBizDeviceByDeviceId(deviceId);
    }
}
